//
//  MenuViewController.m
//  LO_MUSIC
//
//  Created by 徐强 on 16/2/24.
//  Copyright © 2016年 徐强. All rights reserved.
//

#import "MenuViewController.h"
#import "AppDelegate.h"
#import "MusicViewController.h"
#import "ReadViewController.h"

@interface MenuViewController ()

@end

@implementation MenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton *music = [UIButton buttonWithType:(UIButtonTypeSystem)];
    music.frame = CGRectMake(50, 200, 100, 50);
    [music setTitle:@"音乐" forState:(UIControlStateNormal)];
    [music addTarget:self action:@selector(musicAction) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:music];
    
    UIButton *read = [UIButton buttonWithType:(UIButtonTypeSystem)];
    read.frame = CGRectMake(50, 300, 100, 50);
    [read setTitle:@"阅读" forState:(UIControlStateNormal)];
    [read addTarget:self action:@selector(readAction) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:read];
    
}

- (void)musicAction {
    //
    MusicViewController *music = [MusicViewController  new];
    UINavigationController *music_na = [[UINavigationController alloc] initWithRootViewController:music];
    // 设置根视图控制器
    AppDelegate *app = [UIApplication sharedApplication].delegate;
    [app.draw setRootViewController:music_na];
}

- (void)readAction {
    ReadViewController *read = [ReadViewController new];
    // 设置跟视图控制器
    AppDelegate *app = [UIApplication sharedApplication].delegate;
    UINavigationController *read_na = [[UINavigationController alloc] initWithRootViewController:read];
    [app.draw setRootViewController:read_na];
}

@end
